<template>
  <div class="amap-page-container">
    <p>
      文档地址: <a href="https://elemefe.github.io/vue-amap/#/zh-cn/base/amap" target="_blank">https://elemefe.github.io/vue-amap/#/zh-cn/base/amap</a>
    </p>
    <el-amap vid="amapDemo" :zoom="zoom" :center="center" class="amap-demo">
      <el-amap-ellipse
        :key="index"
        v-for="(ellipse,index) in ellipses"
        :events="ellipse.events"
        :center="ellipse.center"
        :radius="ellipse.radius"></el-amap-ellipse>
    </el-amap>
  </div>
</template>

<script>
import VueAMap from 'vue-amap'

VueAMap.initAMapApiLoader({
  key: '59ec5ef06b273ce4796c72c130d7116c',
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  v: '1.4.4'
})

export default {
  components: { VueAMap },
  data () {
    return {
      zoom: 12,
      center: [121.5273285, 31.21515044],
      ellipses: [
        {
          center: [121.5273285, 31.21515044],
          radius: [500, 1000],
          events: {
            click: () => {
              alert('click')
            }
          }
        }
      ]
    }
  }
}
</script>

<style scoped>
  .amap-page-container {
    height: 500px;
  }
</style>
